home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 002a / be310.zip / COMMENT.CHS < prev    next >
Text File  |  1993-06-01  |  2KB  |  45 lines

  1. /* CHESS FUNCTION(S): do_comment(int aft)
  2. /*              DATE: 3/22/93
  3. /*            AUTHOR: C. Schanck
  4. /* 
  5. /*       DESCRIPTION: This function will comment the currently
  6. /* linemarked block of text with a leading '/* ' string (for C and
  7. /* Chess program files.  If the argument 'aft' is set to a non-zero
  8. /* value, the end of each of the lines will have the string ' */'
  9. /* appended to it (for C files).
  10. /*
  11. /*  REVISION HISTORY:
  12. /*  Author   Date     Purpose
  13. /*  ------   ----     -------
  14. do_comment
  15. int aft
  16. {            
  17.    int retval,top,bot,aft;
  18.    set_display(0);            /* turn the display off...
  19.    if(ask("file_in_mark")==1) /* do we have a line marked block
  20.    {                     
  21.       Line_mark();            /* end the line mark
  22.       Top_of_block();         /* go to the top 
  23.       Begin_line();
  24.       set_recall("");         /* forget the entries
  25.       Replace("~^~ ~////* ~ ~mgrp~");     /* replace the beginning of the line
  26.       if(aft)
  27.       {                       /* if we are to do the end as well
  28.          set_msg_wait(0);     /* turn message wait off for replace
  29.          while(Search("~$~ ~mr~")!=0)  /* for each eol
  30.          {
  31.             put_text_curr(0," */");    /* append string
  32.             Begin_line();              /* go to the beginning
  33.             if(Cursor_down()==0)       /* next line, if possible
  34.                break;
  35.          }
  36.       }
  37.       retval=1;            /* successful
  38.    }
  39.    else
  40.       retval=0;            /* failed
  41.  
  42.    set_display(1);         /* re-enable display
  43.    update_display();       /* repaint screen
  44.    return(retval);         /* return value
  45. }